<template>
  <a-form :form="recordForm" layout="inline">
    <a-form-item>
      <a-input allowClear placeholder="这里输入关键词搜索" v-model="queryParam" />
    </a-form-item>
    <a-form-item>
      <a-button type="primary" icon="search" class="mr5" @click="handleBtnClick">查询</a-button>
      <slot name="btn"></slot>
    </a-form-item>
  </a-form>
</template>

<script>
export default {
  name: 'RecordForm',
  data() {
    return {
      recordForm: this.$form.createForm(this),
      queryParam: '',
      btnControl: true
    }
  },
  prop: {
    btnControl: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    handleBtnClick() {
      if (this.queryParam !== '') {
        this.$emit('search', this.queryParam)
      }
    }
  }
}
</script>
